package com.example.demo.controller;

import com.example.demo.model.AyUser;
import com.example.demo.service.AyUserService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("/ayUser")
@ResponseBody
public class AyUserController {
    @Resource
    private AyUserService ayUserService;
    @RequestMapping("/test")
    @ResponseBody
    public List<AyUser> test(Model model)
    {//查询数据库所用用户
        List<AyUser> ayUser =ayUserService.findAll();
        model.addAttribute("users",ayUser);
        return ayUser;

    }
}
